<template>
	<!-- 部门下拉框组件 -->
	<v-combobox v-model="selectDepartment" :items="departmentItems" :label="selectDepartmentCommentModel.label"
		:return-object="selectDepartmentCommentModel.isReturnObj" @input="departmentEvent" dense outlined chips>
	</v-combobox>
</template>

<script>
	export default {
			name: 'DapartmentSelect',
			props: {
				callBack: {
					type: Function, //参数类型：函数
				},
				selectDepartmentCommentModel: {
					loadSelectDepartmentItemsUrl: ``,
					label:'选择部门',
					//是否返回对象，部返回对象则是返回select的value值
					isReturnObj:false
				},
			},
			data: () => ({
				departmentItems: [],
				selectDepartment: null
			}),
		
			created() {
				this.loadSelectDepartmentItems()
			},
			methods: {
				async loadSelectDepartmentItems() {
					var response = await this.$httpRequest({
						url: this.selectDepartmentCommentModel.loadSelectDepartmentItemsUrl,
						method: 'get',
					})
	
					if (response.status == 1) {
						this.departmentItems = response.data
					} else {
						this.$message.error(response.info)
					}
				},
				departmentEvent(item) {
					this.$props.callBack(item)
				}
			}
		}
	
</script>

